package com.jlpay.openapi.demo.openmerch.change;

import com.jlpay.open.jlpay.sdk.java.model.openmerch.SettleMode;
import com.jlpay.open.jlpay.sdk.java.model.openmerch.change.request.SettleRuleModifyRequest;
import com.jlpay.open.jlpay.sdk.java.model.openmerch.change.response.SettleRuleModifyResponse;
import com.jlpay.open.jlpay.sdk.java.utils.json.JsonUtils;
import com.jlpay.openapi.demo.JlpayOpenApiService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.UUID;

/**
 * 商户结算规则修改
 *
 * @author zhangyongfeng
 * @date 2025/8/1
 */
public class SettleRuleModifyService {

    private static final Logger LOGGER = LoggerFactory.getLogger(SettleRuleModifyService.class);

    public static void main(String[] args) {
        SettleRuleModifyRequest request = buildRequest();
        SettleRuleModifyResponse response = JlpayOpenApiService.openMerchWithCryptoService()
                .post(request, SettleRuleModifyResponse.class);
        LOGGER.info("商户结算规则修改响应:{}", JsonUtils.toString(response));
    }

    private static SettleRuleModifyRequest buildRequest() {
        SettleRuleModifyRequest request = new SettleRuleModifyRequest();
        request.setApplyId(UUID.randomUUID().toString().replaceAll("-", ""));
        // 商户号
        request.setMerchNo("849584358140108");
        request.setSettleMode(SettleMode.AUTO_T1);
        request.setDayCut("000000");
        request.setSettleSession("070000");
        request.setAccountChangeFlag("1");
        request.setPostscript("嘉联结算");
        return request;
    }
}
